#include "GameState.h"

namespace catan
{

GameState::GameState(): _isRunning(true), isFrameDrawn(false), isMaskDrawn(true), areHexagonsDrawn(true), isBackgroundDrawn(true), isPreStartGame(true), isPlacingSettlement(true)
{
	keyDownEventRef = NULL;
	mouseButtonDownEventRef = NULL;
	mouseMotionEventRef = NULL;
}

GameState::~GameState()
{
}

void GameState::end()
{
	_isRunning = false;
}

bool GameState::isRunning()
{
	return _isRunning;
}

bool GameState::getIsFrameDrawn()
{
	return isFrameDrawn;
}

void GameState::toggleFrame()
{
	isFrameDrawn = !isFrameDrawn;
}

bool GameState::getIsMaskDrawn()
{
	return isMaskDrawn;
}

void GameState::toggleMask()
{
	isMaskDrawn = !isMaskDrawn;
}

bool GameState::getAreHexagonsDrawn()
{
	return areHexagonsDrawn;
}

void GameState::toggleHexagons()
{
	areHexagonsDrawn = !areHexagonsDrawn;
}

bool GameState::getIsBackgroundDrawn()
{
	return isBackgroundDrawn;
}

void GameState::toggleBackground()
{
	isBackgroundDrawn = !isBackgroundDrawn;
}

SDL_Event *GameState::pollKeyDownEvent()
{
	SDL_Event *retval = keyDownEventRef;
	keyDownEventRef = NULL;
	return retval;
}

void GameState::setIsPlacingSettlement(bool isPlacingSettlement)
{
	this->isPlacingSettlement = isPlacingSettlement;
}

bool GameState::getIsPlacingSettlement()
{
	return isPlacingSettlement;
}

void GameState::setIsPreStartGame(bool isPreStartGame)
{
	this->isPreStartGame = isPreStartGame;
}
bool GameState::getIsPreStartGame()
{
	return isPreStartGame;
}

void GameState::queueKeyDownEvent(SDL_Event &event)
{
	keyDownEventRef = &event;
}

SDL_Event *GameState::pollMouseButtonDownEvent()
{
	SDL_Event *retval = mouseButtonDownEventRef;
	mouseButtonDownEventRef = NULL;
	return retval;
}

void GameState::queueMouseButtonDownEvent(SDL_Event &event)
{
	mouseButtonDownEventRef = &event;
}

SDL_Event *GameState::pollMouseMotionEvent()
{
	SDL_Event *retval = mouseMotionEventRef;
	mouseMotionEventRef = NULL;
	return retval;
}

void GameState::queueMouseMotionEvent(SDL_Event &event)
{
	mouseMotionEventRef = &event;
}

}
